												
<!DOCTYPE html>
<html lang="zh-cn">
	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <title></title>
	    <#include "/common/meta.ftl"/>
	    <#include "/common/form.ftl"/>
		<script>				
			//上传附件
			function uploadAttachment()
            {
				top.layer.open({
				  type: 2,
				  title: '上传附件',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['580px','300px'],
				  content: './attachmentForm?sourceId=${sourceId!''}',
				  end: function () {
                		location.reload();
            	  }
				}); 
			}
			function downLoadAttachment(attachmentId){
				location.href = "./downLoadAttachment?attachmentId="+attachmentId;
			}
			function deleteAttachment(attachmentId){
				if(confirm("确定删除附件吗?")){
					$.post('./deleteAttachment', {attachmentId: attachmentId}, function(data) {
							if(data.success){
								location.href=location.href;
							}
					},'json');					
				}
			}
		</script>
	</head>
    <body style="">
    <div style="padding:5px;">
        <form id="attachmentListForm" action="./attachmentPageList" method="post">
            <input type="hidden" id="orderField" name="orderField" value="${orderField!''}"/>
            <input type="hidden" id="isAsc" name="isAsc" value="${isAsc!''}"/>
            <input type="hidden" id="sourceId" name="sourceId" value="${sourceId!''}"/>
		<#if sourceId?exists>
            <div style="margin-bottom:4px;">
                <button class="btn btn-primary" onclick="uploadAttachment();" type="button"><i
                        class="icon icon-plus"></i>上传附件
                </button>
            </div>
            <table class="table table-hover table-bordered table-condensed" style="margin:0px;">
                <thead>
                <tr>
                    <th style="text-align:center;width:60px;">序号</th>
                    <th style="text-align:center;">
                        附件名称
                    </th>
                    <th style="text-align:center;">
                        文件大小
                    </th>
                    <th style="text-align:center;">
                        上传时间
                    </th>
                    <th style="text-align:center;width:120px;">操作</th>
                </tr>
                </thead>
                <tbody>
					<#list data.records as x>
                    <tr>
                        <td style="text-align:center;">
						${x_index + 1}
                        </td>
                        <td style="text-align:center;">
							<#if x.attachmentName?length gt 25>
							${ x.attachmentName?substring(0,24)} .......${x.attachmentSuffix!''}
							<#else>
							${ x.attachmentName!''}.${x.attachmentSuffix!''}
							</#if>
                        </td>
                        <td style="text-align:center;">${x.attachmentSize!''}</td>
                        <td style="text-align:center;">${x.attachmentUptime!''}</td>
                        <td style="text-align:center">
                            <a href="javascript:downLoadAttachment('${x.attachmentId}');">下载</a>&nbsp;&nbsp;&nbsp;
                            <a href="javascript:deleteAttachment('${x.attachmentId}');">删除</a>
                        </td>
                    </tr>
					</#list>
                </tbody>
            </table>
			<#include "/common/page_v1.ftl"/>
		</#if>
        </form>
    </div>
    </body>
</html>